#define _CRT_SECURE_NO_WARNINGS 1
#include"string.h"
#include<string>
using std::cout;
using std::cin;
using std::endl;
using namespace qiangsir;
void test1()
{
	qiangsir::string s1;
	qiangsir::string s2("hello world");
	cout << s2.c_str() << endl;
	const string s3("helo const");
	cout << s3.c_str() << endl;
}
void test2()
{
	string s1("hello world");
	string::iterator it = s1.begin();
	while (it != s1.end())
	{
		cout << *it;
		(*it)++;
		it++;
	}
	cout << endl;
	for (auto e : s1)
	{
		cout << e << " ";
	}
	cout << endl << "____________" << endl;
	const string s2("hello world");
	string::const_iterator it2 = s2.begin();
	while (it2 != s2.end())
	{
		cout << *it2;
		it2++;
	}
	cout << endl;
	for (auto e : s2)
	{
		cout << e << " ";
	}

}
void test3()
{
	string s1("hello world");
	cout << s1[3] << endl;
	s1[3]++;
	cout << s1[3] << endl;
	const string s2("sgdshgj");
	cout << s2[3] << endl;
}
void test4()
{
	string s1("hello world");
	/*s1.reserve(19);
	s1.append(" dsfgjsf");
	cout << s1.c_str() << endl;
	s1.push_back('h');
	cout << s1.c_str() << endl;*/
	cout << (s1.insert(5, 'M')).c_str() << endl;;
	cout << s1.c_str() << endl;
	cout << (s1.insert(5, "nihao")).c_str() << endl;;
	cout << s1.c_str() << endl;
	cout << (s1.erase(5, 4)).c_str() << endl;;

}
const int string::npos = -1;
void test5()
{
	string s1("hello world");
	string s2("beybey world");
	cout << s1.c_str() << endl;
	cout << s2.c_str() << endl;
	s1.swap(s2);
	cout << s1.c_str() << endl;
	cout << s2.c_str() << endl;
	swap(s1, s2);
	cout << s1.c_str() << endl;
	cout << s2.c_str() << endl;
	
	cout << (s1 == s2) << (s1 == "hello world") << ("beybey word" == s2);
}
void test6()
{
	string s("hello world");
	/*cin >> s;
	cout << s<<endl;
	getline(cin, s);
	cout << s;*/
	cout << s.find('w') << endl;
	cout << s.find("ld") << endl;
	
}
void test7()
{
	string s1("hello world");
	string s3;
	s3 = s1;
	
	/*s3 = s1;
	cout << s1 << endl;
	cout << s1 << endl;
	cout << s3 << endl;
	cout << (s3.size() )<< endl;
	cout << (s3.capacity()) << endl;*/
}
void test8()
{
	string s = "123";
	s.resize(5, '1');
	cout << s << endl;
	s.resize(2, '1');
	cout << s << endl;
}
int main()
{
	test8();
	return 0;
}  